$OpenBSD: patch-src_base_PdfXRefStream_cpp,v 1.1.1.1 2014/04/06 11:31:21 sthen Exp $

For some reason, alloca() doesn't seem to be working from C++ on OpenBSD,
returning a linker error, so convert to malloc() instead.

--- src/base/PdfXRefStream.cpp.orig	Mon Mar 31 22:47:08 2014
+++ src/base/PdfXRefStream.cpp	Mon Mar 31 22:51:31 2014
@@ -64,7 +64,11 @@ void PdfXRefStream::WriteSubSection( PdfOutputDevice*,
 void PdfXRefStream::WriteXRefEntry( PdfOutputDevice*, pdf_uint64 offset, pdf_gennum generation, 
                                     char cMode, pdf_objnum objectNumber ) 
 {
-    char * buffer = reinterpret_cast<char*>(alloca(m_bufferLen));
+    char * buffer = reinterpret_cast<char*>(malloc(m_bufferLen)); 
+    if( !buffer )
+    {
+        PODOFO_RAISE_ERROR( ePdfError_OutOfMemory );
+    }
 
     if( cMode == 'n' && objectNumber == m_pObject->Reference().ObjectNumber() )
         m_offset = offset;
@@ -76,6 +80,7 @@ void PdfXRefStream::WriteXRefEntry( PdfOutputDevice*, 
     memcpy( &buffer[1], reinterpret_cast<const char*>(&offset_be), sizeof(pdf_uint64) );
     
     m_pObject->GetStream()->Append( buffer, m_bufferLen );
+    free(buffer);
 }
 
 void PdfXRefStream::EndWrite( PdfOutputDevice* pDevice ) 
